﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_ETC_LEGO_MGT_Insert')
	BEGIN
		DROP Procedure usp_UPDMS_ETC_LEGO_MGT_Insert
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_ETC_LEGO_MGT_Insert
**	Desc : 레고관리를 저장한다.
**	Test Exec Query : Exec usp_UPDMS_ETC_LEGO_MGT_Insert
**	Called by : Etc_Dac_UPDMS_ETC_LEGO_MGT.cs
**	Program ID : Etc1014m
**	Auth : 송시명
**	Date : 2014-09-11
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**			
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_ETC_LEGO_MGT_Insert]
@Seq int,
@Series nvarchar(5),
@Prod_No varchar(10),
@Prod_Nm nvarchar(200),
@Price int,
@Brick_Cnt int,
@Brick_Weight decimal(10, 3),
@Figure_Cnt int,
@Buy_Dt nvarchar(10),
@Contents nvarchar(max),
@Keyword nvarchar(max),
@Attach_File_Info nvarchar(max),
@Create_User nvarchar(20),
@Create_Dt datetime,
@Update_User nvarchar(20),
@Update_Dt datetime
AS
SET NOCOUNT OFF

DECLARE @New_Seq int

INSERT INTO UPDMS_ETC_LEGO_MGT (
       Series,
       Prod_No,
       Prod_Nm,
       Price,
       Brick_Cnt,
       Brick_Weight,
       Figure_Cnt,
       Buy_Dt,
       Contents,
       Keyword,
       Create_User,
       Create_Dt,
       Update_User,
       Update_Dt
)
VALUES (
       @Series,
       @Prod_No,
       @Prod_Nm,
       @Price,
       @Brick_Cnt,
       @Brick_Weight,
       @Figure_Cnt,
       @Buy_Dt,
       @Contents,
       @Keyword,
       @Create_User,
       GETDATE(),
       @Update_User,
       GETDATE()
)

SET @New_Seq = @@IDENTITY

--첨부파일 저장
EXEC usp_UPDMS_COM_FILE_Insert_Xml @New_Seq, 'Etc1014m', @Attach_File_Info

GO